package com.androidx.p013lv.base.http;

import com.androidx.p013lv.base.BaseSdk;
import com.androidx.p013lv.base.http.callback.HttpCallback;
import com.androidx.p013lv.base.http.callback.HttpCallbackM3u8;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.cache.CacheMode;
import com.lzy.okgo.model.HttpHeaders;
import com.lzy.okgo.model.HttpParams;
import com.lzy.okgo.request.GetRequest;
import com.lzy.okgo.request.PostRequest;
import com.lzy.okgo.request.PutRequest;
import java.io.File;
import org.json.JSONObject;

/* renamed from: com.androidx.lv.base.http.HttpUtils */
public class HttpUtils {

    /* access modifiers changed from: private */
    /* renamed from: com.androidx.lv.base.http.HttpUtils$SingletonHolder */
    public static class SingletonHolder {
        private static final HttpUtils instance = new HttpUtils();

        private SingletonHolder() {
        }
    }

    private HttpUtils() {
    }

    public static final HttpUtils getInsatance() {
        return SingletonHolder.instance;
    }

    public <T> void post(String str, HttpCallback<T> httpCallback) {
        ((PostRequest) ((PostRequest) ((PostRequest) OkGo.post(str).cacheKey(str)).tag(httpCallback.getTag())).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public <T> void post(String str, HttpParams httpParams, HttpCallback<T> httpCallback) {
        ((PostRequest) ((PostRequest) ((PostRequest) ((PostRequest) OkGo.post(str).cacheKey(str)).tag(httpCallback.getTag())).params(httpParams)).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public <T> void post(String str, JSONObject jSONObject, HttpCallback<T> httpCallback) {
        ((PostRequest) ((PostRequest) ((PostRequest) ((PostRequest) OkGo.post(str).tag(httpCallback.getTag())).cacheKey(str + "_" + jSONObject.toString())).upJson(jSONObject)).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public <T> void post(String str, String str2, HttpCallback<T> httpCallback) {
        ((PostRequest) ((PostRequest) ((PostRequest) ((PostRequest) OkGo.post(str).tag(httpCallback.getTag())).cacheKey(str + "_" + str2)).upJson(str2)).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public <T> void put(String str, String str2, HttpCallback<T> httpCallback) {
        ((PutRequest) ((PutRequest) ((PutRequest) ((PutRequest) OkGo.put(str).tag(httpCallback.getTag())).cacheKey(str + "_" + str2)).upJson(str2)).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public <T> void post_form(String str, File file, HttpCallback<T> httpCallback) {
        ((PostRequest) ((PostRequest) ((PostRequest) OkGo.post(str).isMultipart(true)).tag(httpCallback.getTag())).params("file", file)).execute(httpCallback);
    }

    public <T> void get(String str, HttpCallback<T> httpCallback) {
        ((GetRequest) ((GetRequest) ((GetRequest) OkGo.get(str).tag(httpCallback.getTag())).cacheKey(str)).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public <T> void get(String str, HttpCallbackM3u8<T> httpCallbackM3u8) {
        ((GetRequest) ((GetRequest) ((GetRequest) OkGo.get(str).tag(httpCallbackM3u8.getTag())).cacheKey(str)).cacheMode(CacheMode.NO_CACHE)).execute(httpCallbackM3u8);
    }

    public <T> void get(String str, HttpHeaders httpHeaders, HttpCallback<T> httpCallback) {
        ((GetRequest) ((GetRequest) ((GetRequest) ((GetRequest) OkGo.get(str).headers(httpHeaders)).cacheKey(str)).tag(httpCallback.getTag())).cacheMode(CacheMode.NO_CACHE)).execute(httpCallback);
    }

    public void cancelAllTag() {
        OkGo.cancelAll(BaseSdk.okHttpClient);
    }

    public void cancelTag(String str) {
        OkGo.cancelTag(BaseSdk.getOkHttpClient(), str);
    }
}
